package com.example.book.mapper;

import com.example.book.entity.Chapter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 凡哥哥
 * @since 2023-12-01
 */
@Mapper
public interface ChapterMapper extends BaseMapper<Chapter> {
    @Update("update chapter set update_time =#{updateTime},chapter_title = #{chapterTitle},chapter_number = #{chapterNumber},content = #{content},word_count = #{wordCount} where id = #{id}")
    void update(Chapter chapter);
    @Select("select word_count from chapter where author_id = #{authorId} and book_id = #{bookId}")
    List<String> getTotalText(Long authorId,Long bookId);
    @Select("select * from chapter where chapter_number = #{chapterNumber}")
    Chapter All(Long chapterNumber);
    @Update("update chapter set status =#{status} where id = #{parameters}")
    int updateStatusById(int status, Long parameters);
}
